﻿#pragma once
#include "QR_Encode.h"
#include "control/SCmnCtrl.h"

namespace SOUI
{
	class SQrCtrl :public SImageWnd
	{
		SOUI_CLASS_NAME(SQrCtrl, L"qrctrl")
	public:
		SQrCtrl();
		~SQrCtrl();

		virtual void SetWindowText(LPCTSTR lpszText)override;
		virtual BOOL OnRelayout(const CRect &rcWnd)override;
	protected:
		void CreateQrImg(SStringT strContent);
		void OnPaint(IRenderTarget *pRT);
		void MakeCacheApha(ISkinObj *pSkin, IBitmap *_pBitCache, IBitmap *_pBitMask);

		SOUI_ATTRS_BEGIN()
			ATTR_RECT(L"qrrect", m_QrRect, FALSE)
		SOUI_ATTRS_END()

		SOUI_MSG_MAP_BEGIN()
			MSG_WM_PAINT_EX(OnPaint)
		SOUI_MSG_MAP_END()
	private:
		CRect m_QrRect;
	};
}

